﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;

namespace ListaTelefonicaMEM.Controles
{
    class TextBoxIndice : TextBoxPadrao
    {
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            if (char.IsDigit(e.KeyChar))
            { }
            else if (e.KeyChar == '\b')
            { }
            else if (e.KeyChar == (char)Keys.Space)
            {
                this.Text = "";
            }
            else if (e.KeyChar == (char)Keys.Escape)
            { }
            else
            {
                e.Handled = true;
            }
        }

        public int Valor
        {
            get
            {
                return Int32.Parse(this.Text);
            }
        }
    }
}
